import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { HotelRoomsVO, HotelRoomsForm, HotelRoomsQuery } from '@/api/hotel/hotelRooms/types';

/**
 * 查询酒店房型管理列表
 * @param query
 * @returns {*}
 */

export const listHotelRooms = (query?: HotelRoomsQuery): AxiosPromise<HotelRoomsVO[]> => {
  return request({
    url: '/hotel/hotelRooms/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询酒店房型管理详细
 * @param id
 */
export const getHotelRooms = (id: string | number): AxiosPromise<HotelRoomsVO> => {
  return request({
    url: '/hotel/hotelRooms/' + id,
    method: 'get'
  });
};

/**
 * 新增酒店房型管理
 * @param data
 */
export const addHotelRooms = (data: HotelRoomsForm) => {
  return request({
    url: '/hotel/hotelRooms',
    method: 'post',
    data: data
  });
};

/**
 * 修改酒店房型管理
 * @param data
 */
export const updateHotelRooms = (data: HotelRoomsForm) => {
  return request({
    url: '/hotel/hotelRooms',
    method: 'put',
    data: data
  });
};

/**
 * 删除酒店房型管理
 * @param id
 */
export const delHotelRooms = (id: string | number | Array<string | number>) => {
  return request({
    url: '/hotel/hotelRooms/' + id,
    method: 'delete'
  });
};
export const selectCombByHotel = (hotelId: string | number): AxiosPromise<HotelRoomsVO[]> => {
  return request({
    url: '/hotel/hotelRooms/selectComb/' + hotelId,
    method: 'get'
  });
};
